﻿#include "GameCore.h"
//#include<time.h>

DianJiPai::DianJiPai()
{
    iID = -1;
    nType = _BaseObject::Area_Null;
    nFlags = 0;
    nPlayerID = 0;
    nValue = 0;
    pObject = nullptr;
}

PokeStep::PokeStep()
{
    bSelfFlag = false;
    bMultipleFlag = false;
    nMaxCount = nMinCount = 0;
    nType = _BaseObject::Area_Null;

    nSelectPlayerID = -1;
    nSelectCount = 0;

    memset(nSelectValue,0,sizeof(nSelectValue));
    memset(nSelectType,0,sizeof(nSelectType));
}

void GameCore::WaitForUserAction()
{
    //return 0;
/*
    int strInput = 0;
    scanf("%d",&strInput);
    if(strInput >= 0 && strInput < 20)            //手牌
    {
        m_DianJiPai.nValue = strInput;
        m_DianJiPai.nPlayerID = player;
        m_DianJiPai.iFlag = m_arrayPlayer[player].getShouPaiData(m_DianJiPai.nValue)->iFlag;
        m_DianJiPai.nType = _BaseObject::Area_ShouPai;
        m_DianJiPai.pObject = m_arrayPlayer[player].getShouPaiData(m_DianJiPai.nValue);
    }
    else if(strInput >= 20 && strInput < 24)    //装备
    {
        m_DianJiPai.nValue = strInput - 20;
        m_DianJiPai.nPlayerID = player;
        m_DianJiPai.iFlag = m_arrayPlayer[player].getZhuangBeiData(m_DianJiPai.nValue)->iFlag;
        m_DianJiPai.nType = _BaseObject::Area_ZhuangBei;
        m_DianJiPai.pObject = m_arrayPlayer[player].getZhuangBeiData(m_DianJiPai.nValue);
    }
    else if(strInput >= 24 && strInput < 30)    //判定区
    {
        m_DianJiPai.nValue = strInput - 24;
        m_DianJiPai.nPlayerID = player;
        m_DianJiPai.iFlag = m_arrayPlayer[player].getPandingData(m_DianJiPai.nValue)->iFlag;
        m_DianJiPai.nType = _BaseObject::Area_PanDing;
        m_DianJiPai.pObject = m_arrayPlayer[player].getPandingData(m_DianJiPai.nValue);
    }
    else if(strInput >= 30 && strInput < 40)    //敌人
    {
        m_DianJiPai.nValue = strInput - 30;
        m_DianJiPai.nPlayerID = -1;
        m_DianJiPai.iFlag = m_arrayPlayer[m_DianJiPai.nValue].iFlag;
        m_DianJiPai.nType = _BaseObject::Area_Player;
        m_DianJiPai.pObject = m_arrayPlayer[m_DianJiPai.nValue].getWujiangData();
    }
    else if(strInput >= 40 && strInput < 43)    //按钮
    {
        m_DianJiPai.nValue = strInput - 40;
        m_DianJiPai.nPlayerID = -1;
        m_DianJiPai.iFlag = pGame->Button[m_DianJiPai.nValue];
        m_DianJiPai.nType = _BaseObject::Area_Button;
        m_DianJiPai.pObject = nullptr;
    }
    else if(strInput == 100)
    {
        for(int i=0; i<m_arrayPlayer[player].ShouPaiCount; i++)
        {
            if(m_arrayPlayer[player].getShouPaiData(i)->iValue == GAME_POKE_EMPTY)
                break;
            printf("%d(%d,%d)",i,m_arrayPlayer[player].getShouPaiData(i)->iValue,m_arrayPlayer[player].getShouPaiData(i)->iFlag);
        }
        printf("");
        //printf("输入错误");
    }
    else if(strInput == 101)
    {
        for(int i=0; i<4; i++)
        {
            if(m_arrayPlayer[player].getZhuangBeiData(i) != nullptr)
                printf("%d(%d,%d)",i,m_arrayPlayer[player].getZhuangBeiData(i)->iValue,m_arrayPlayer[player].getZhuangBeiData(i)->iFlag);
        }
        printf("");
        //printf("输入错误");
    }
    else if(strInput == 102)
    {
        for(int i=0; i<4; i++)
        {
            printf("%d(%d,%d)",i,m_arrayPlayer[player].getPandingData(i)->iValue,m_arrayPlayer[player].getPandingData(i)->iFlag);
        }
        printf("");
        //printf("输入错误");
    }
    else if(strInput == 103)
    {
        for(int i=0; i<playerCount; i++)
        {
            printf("%d(%d,%d)",i,m_arrayPlayer[i].getWujiangData()->iValue,m_arrayPlayer[i].tili);
        }
        printf("");
        //printf("输入错误");
    }
    / *
    g_bCanInput = true;

    pDlg->SendMessage(WM_USER_REFRESH);


    InputOverEvent.Lock();

    g_bCanInput = false;

    pDlg->SendMessage(WM_USER_REFRESH);
    */
    //return 0;
}


//根据nType,初始化第nStep个步骤
int GameCore::InitChuPaiStatus(int player, _GameChuPaiType eType, int nValue, int nParam1, int nParam2, QVariant nParam3, int nStep, QString strMsg)
{
    int nCanChoiceCount = 0;    //可以点击的对象数(不包括按钮)
    switch(eType)
    {
    case GameCore::Game_ChuPai_Type_ZhuDong:        //回合时出牌
        {
            switch(nStep)
            {
            case 0:        //第0步
                {
                    ResetAllPlayers(-1);
                    //m_arrayPlayer[player].flagZhuangBeiByValue(_BaseObject::Flag_Null,_Pai::Value_All);
                    nCanChoiceCount = m_arrayPlayer[player].flagShouPai(_BaseObject::Flag_Enable,_Pai::Value_All);

                    //两种武器
                    if( m_arrayPlayer[player].m_nSha > 0 )
                    {
                        nCanChoiceCount += m_arrayPlayer[player].flagZhuangBeiByValue(_BaseObject::Flag_Enable,_Pai::Value_ZhangBa);
                        nCanChoiceCount += m_arrayPlayer[player].flagZhuangBeiByValue(_BaseObject::Flag_Enable,_Pai::Value_TanSu);
                    }
                    //闪
                    nCanChoiceCount -= m_arrayPlayer[player].flagShouPai(_BaseObject::Flag_Null,_Pai::Value_Shan);
                    //桃
                    if(m_arrayPlayer[player].m_nTiLi >= m_arrayPlayer[player].m_nTiLiShangXian)
                        nCanChoiceCount -= m_arrayPlayer[player].flagShouPai(_BaseObject::Flag_Null,_Pai::Value_Tao);
                    //闪电
                    if(m_arrayPlayer[player].getPaiCount(_Pai::Value_ShanDian,_BaseObject::Area_PanDing) == 1 )
                        nCanChoiceCount -= m_arrayPlayer[player].flagShouPai(_BaseObject::Flag_Null,_Pai::Value_ShanDian);

                    //杀
                    bool bSha = false;  //是否可出杀
                    if(m_arrayPlayer[player].m_nSha > 0)
                        bSha = true;
                    //if(!bSha && m_arrayPlayer[player].getZhuangBeiData(_BaseObject::Area_WuQi) != nullptr)
                    if(!bSha && m_arrayPlayer[player].containZhuangBei(_Pai::Value_LianNu))
                    {
                        bSha = true;
                    }
                    if(!bSha && m_arrayPlayer[player].containJiNeng(_JiNeng::JiNengValue_MengGuDiGuo))
                        bSha = true;
                    if(!bSha)
                        nCanChoiceCount -= m_arrayPlayer[player].flagShouPai(_BaseObject::Flag_Null,_Pai::Value_Sha);

                    /*
                    if(m_arrayPlayer[player].m_nSha <= 0 && !(m_arrayPlayer[player].getZhuangBeiData(_BaseObject::Area_WuQi) != nullptr))
                    {
                        if(m_arrayPlayer[player].getZhuangBeiData(_BaseObject::Area_WuQi)->value() == _Pai::Value_LianNu)    //诸葛连弩
                        {
                            bSha = true;
                        }
                    }*/


                    //借刀
                    if(EnableAllPlayersByZhuangBei(player,_Pai::Value_All,true) == 0)
                        m_arrayPlayer[player].flagShouPai(_BaseObject::Flag_Null,_Pai::Value_JieDao);


                    //技能
                    QObjectList::const_iterator iiJiNengPai;
                    for (iiJiNengPai = m_arrayPlayer[player].m_listJiNengPai.constBegin(); iiJiNengPai != m_arrayPlayer[player].m_listJiNengPai.constEnd(); ++iiJiNengPai)
                    {
                        _Pai *pJiNeng = (_Pai*)(*iiJiNengPai);
                        switch (pJiNeng->value())
                        {
                        case _Pai::Value_JiNeng_ZhanZhengZhiShen:
                            if(bSha)
                                pJiNeng->setFlags(_BaseObject::Flag_Enable, _BaseObject::FlagType_Set);
                            break;
                        case _Pai::Value_JiNeng_MengNaLiSha:
                            if(bSha)
                                pJiNeng->setFlags(_BaseObject::Flag_Enable, _BaseObject::FlagType_Set);
                            break;
                        case _Pai::Value_JiNeng_KaiSa:
                            if(0 == pJiNeng->m_listJiNeng.at(0)->m_nJiNengParam)
                                pJiNeng->setFlags(_BaseObject::Flag_Null, _BaseObject::FlagType_Set);
                            else
                                pJiNeng->setFlags(_BaseObject::Flag_Enable, _BaseObject::FlagType_Set);
                            break;
                        default:
                            pJiNeng->setFlags(_BaseObject::Flag_Null, _BaseObject::FlagType_Set);
                            break;
                        }
                    }


                    FlagMenus(_BaseObject::Flag_Null,_BaseObject::Flag_Null,_BaseObject::Flag_Enable);



                    HidePlayersArea();

                    m_arrayStep[nStep].bSelfFlag = true;
                    m_arrayStep[nStep].bMultipleFlag = false;
                    m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                    m_arrayStep[nStep].nType = _BaseObject::Area_ShouPai | _BaseObject::Area_ZhuangBei | _BaseObject::Area_JiNeng;

                    emit s_Debug(_T("%1玩家可选手牌数为:%2").arg(player).arg(nCanChoiceCount));

                    if(m_arrayPlayer[player].isMe())
                    {
                        m_strMsg = m_hashGameMessage[_Pai::Value_All][0];
                        ShowChuPaiMessage(m_strMsg, 0);
                    }


                    //初始化所有
                    //牌的状态
                    //此步骤的step[nStep]的各个内容
                }
                break;


            default:    //处理第1~n步
                {
                    if(m_arrayStep[0].nSelectType[0] == _BaseObject::Area_ZhuangBei)        //选的是武器
                    {
                        switch(m_arrayPlayer[player].getZhuangBeiData((_BaseObject::_Area)m_arrayStep[0].nSelectValue[0])->value())
                        {
                        case _Pai::Value_ZhangBa:
                            switch(nStep)        //第几步
                            {
                            case 1:
                                nCanChoiceCount =  ChuPai_ZhangBa(player,eType,nStep);
                                break;

                            case 2:
                                FlagMenus(_BaseObject::Flag_Null,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);

                                m_arrayStep[nStep].bSelfFlag = false;
                                m_arrayStep[nStep].bMultipleFlag = false;
                                m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                m_arrayStep[nStep].nType = _BaseObject::Area_Player;

                                FlagAllPlayers(_BaseObject::Flag_Null, _BaseObject::FlagType_Set, -1);
                                nCanChoiceCount = EnableAllPlayersByDistent(player,2);

                                if(m_arrayPlayer[player].isMe())
                                {
                                    m_strMsg = m_hashGameMessage[_Pai::Value_Sha][0]
                                            .arg(_Pai::getName(_Pai::Value_Sha));
                                            //.arg(_Pai::getName(_Pai::Value_ZhangBa));
                                    ShowChuPaiMessage(m_strMsg, 0);
                                }
                                break;

                            case 3:
                                //nCanChoiceCount = 3;
                                FlagMenus(_BaseObject::Flag_Enable,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);

                                m_arrayStep[nStep].bSelfFlag = true;
                                m_arrayStep[nStep].bMultipleFlag = false;
                                m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                m_arrayStep[nStep].nType = _BaseObject::Area_Button;

                                //shortMsg = _T("使用%1")
                                //        .arg(_Pai::getName(_Pai::Value_Sha));
                                break;

                            default:
                                emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR Value_ZhangBa Step!"));
                                setGameStatus(Game_Status_ERROR);
                                return -1;
                            }
                            break;

                        case _Pai::Value_TanSu:
                            switch(nStep)        //第几步
                            {
                            case 1:
                                nCanChoiceCount = ChuPai_TanSu(player,eType,nStep);
                                break;

                            case 2:
                                FlagMenus(_BaseObject::Flag_Null,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);

                                m_arrayStep[nStep].bSelfFlag = false;
                                m_arrayStep[nStep].bMultipleFlag = false;
                                m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                m_arrayStep[nStep].nType = _BaseObject::Area_Player;

                                FlagAllPlayers(_BaseObject::Flag_Null, _BaseObject::FlagType_Set, -1);
                                nCanChoiceCount = EnableAllPlayersByDistent(player,2);

                                if(m_arrayPlayer[player].isMe())
                                {
                                    m_strMsg = m_hashGameMessage[_Pai::Value_Sha][0]
                                            .arg(_Pai::getName(_Pai::Value_Sha));
                                            //.arg(_Pai::getName(_Pai::Value_TanSu));
                                    ShowChuPaiMessage(m_strMsg, 0);
                                }
                                break;

                            case 3:
                                //nCanChoiceCount = 3;
                                FlagMenus(_BaseObject::Flag_Enable,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);

                                m_arrayStep[nStep].bSelfFlag = true;
                                m_arrayStep[nStep].bMultipleFlag = false;
                                m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                m_arrayStep[nStep].nType = _BaseObject::Area_Button;

                                //shortMsg = _T("使用%1")
                                //        .arg(_Pai::getName(_Pai::Value_Sha));
                                break;

                            default:
                                emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR Value_TanSu Step!"));
                                setGameStatus(Game_Status_ERROR);
                                return -1;
                            }
                            break;
                        default:
                            emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR!"));
                            setGameStatus(Game_Status_ERROR);
                            return -1;
                        }
                    }


                    else if(m_arrayStep[0].nSelectType[0] == _BaseObject::Area_ShouPai)    //选的是手牌
                    {
                        switch(m_arrayPlayer[player].getShouPaiData(m_arrayStep[0].nSelectValue[0])->value())
                        {
                        case _Pai::Value_Sha:                //选的是杀
                            switch(nStep)        //第几步
                            {
                            case 1:
                                FlagMenus(_BaseObject::Flag_Null,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);

                                m_arrayStep[nStep].bSelfFlag = false;
                                m_arrayStep[nStep].bMultipleFlag = false;
                                m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                m_arrayStep[nStep].nType = _BaseObject::Area_Player;

                                FlagAllPlayers(_BaseObject::Flag_Null, _BaseObject::FlagType_Set, -1);
                                nCanChoiceCount = EnableAllPlayersByDistent(player,2);

                                if(m_arrayPlayer[player].isMe())
                                {
                                    m_strMsg = m_hashGameMessage[_Pai::Value_Sha][0]
                                            .arg(_Pai::getName(_Pai::Value_Sha));
                                    ShowChuPaiMessage(m_strMsg, 0);
                                }
                                break;
                            case 2:
                                //nCanChoiceCount = 3;
                                FlagMenus(_BaseObject::Flag_Enable,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);

                                m_arrayStep[nStep].bSelfFlag = true;
                                m_arrayStep[nStep].bMultipleFlag = false;
                                m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                m_arrayStep[nStep].nType = _BaseObject::Area_Button;

                                //shortMsg = _T("使用%1")
                                //        .arg(_Pai::getName(_Pai::Value_Sha));
                                break;

                            default:
                                emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR Value_Sha Step!"));
                                setGameStatus(Game_Status_ERROR);
                                return -1;
                            }
                            break;

                        case _Pai::Value_Tao:                //选的是桃
                            switch(nStep)        //第几步
                            {
                            case 1:
                                //nCanChoiceCount = 3;
                                FlagMenus(_BaseObject::Flag_Enable,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);

                                m_arrayStep[nStep].bSelfFlag = true;
                                m_arrayStep[nStep].bMultipleFlag = false;
                                m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                m_arrayStep[nStep].nType = _BaseObject::Area_Button;

                                //shortMsg = _T("使用%1")
                                //        .arg(_Pai::getName(_Pai::Value_Tao));
                                break;

                            default:
                                emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR Value_Tao Step!"));
                                setGameStatus(Game_Status_ERROR);
                                return -1;
                            }
                            break;

                        case _Pai::Value_Shun:                //选的是顺
                            switch(nStep)        //第几步
                            {
                            case 1:
                                FlagMenus(_BaseObject::Flag_Null,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);

                                m_arrayStep[nStep].bSelfFlag = false;
                                m_arrayStep[nStep].bMultipleFlag = false;
                                m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                m_arrayStep[nStep].nType = _BaseObject::Area_Player;

                                FlagAllPlayers(_BaseObject::Flag_Null, _BaseObject::FlagType_Set, -1);
                                nCanChoiceCount = EnableAllPlayersByDistent(player,1);
                                nCanChoiceCount -= FlagAllPlayersByPaiCount(_BaseObject::Flag_Null, 0, 0, player, false, 2);

                                if(m_arrayPlayer[player].isMe())
                                {
                                    m_strMsg = m_hashGameMessage[_Pai::Value_Shun][0]
                                            .arg(_Pai::getName(_Pai::Value_Shun));
                                    ShowChuPaiMessage(m_strMsg, 0);
                                }
                                break;

                            case 2:
                                FlagMenus(_BaseObject::Flag_Null,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);

                                m_arrayStep[nStep].bSelfFlag = false;
                                m_arrayStep[nStep].bMultipleFlag = false;
                                m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                m_arrayStep[nStep].nType = _BaseObject::Area_ShouPai | _BaseObject::Area_ZhuangBei | _BaseObject::Area_PanDing;

                                nCanChoiceCount = m_arrayPlayer[m_arrayStep[1].nSelectPlayerID].flagShouPai(_BaseObject::Flag_Enable,_Pai::Value_All);
                                nCanChoiceCount += m_arrayPlayer[m_arrayStep[1].nSelectPlayerID].flagZhuangBeiByValue(_BaseObject::Flag_Enable,_Pai::Value_All);
                                nCanChoiceCount += m_arrayPlayer[m_arrayStep[1].nSelectPlayerID].flagPanDing(_BaseObject::Flag_Enable,_Pai::Value_All);

                                if(m_arrayPlayer[player].isMe() && !m_arrayPlayer[player].m_bTuoGuan)
                                    ShowPlayersArea(m_arrayStep[1].nSelectPlayerID);

                                if(m_arrayPlayer[player].isMe())
                                {
                                    m_strMsg = m_hashGameMessage[_Pai::Value_Shun][1]
                                            .arg(_Pai::getName(_Pai::Value_Shun));
                                    ShowChuPaiMessage(m_strMsg, 0);
                                }
                                break;

                            case 3:
                                //nCanChoiceCount = 3;
                                FlagMenus(_BaseObject::Flag_Enable,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);

                                m_arrayStep[nStep].bSelfFlag = true;
                                m_arrayStep[nStep].bMultipleFlag = false;
                                m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                m_arrayStep[nStep].nType = _BaseObject::Area_Button;

                                //shortMsg = _T("使用%1")
                                //        .arg(_Pai::getName(_Pai::Value_Shun));
                                break;

                            default:
                                emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR Value_Shun Step!"));
                                setGameStatus(Game_Status_ERROR);
                                return -1;
                            }
                            break;

                        case _Pai::Value_Chai:                //选的是拆
                            switch(nStep)        //第几步
                            {
                            case 1:
                                FlagMenus(_BaseObject::Flag_Null,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);

                                m_arrayStep[nStep].bSelfFlag = false;
                                m_arrayStep[nStep].bMultipleFlag = false;
                                m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                m_arrayStep[nStep].nType = _BaseObject::Area_Player;

                                nCanChoiceCount = FlagAllPlayers(_BaseObject::Flag_Enable, _BaseObject::FlagType_Set, player);
                                nCanChoiceCount -= FlagAllPlayersByPaiCount(_BaseObject::Flag_Null, 0, 0, player, false, 0);

                                if(m_arrayPlayer[player].isMe())
                                {
                                    m_strMsg = m_hashGameMessage[_Pai::Value_Chai][0]
                                            .arg(_Pai::getName(_Pai::Value_Chai));
                                    ShowChuPaiMessage(m_strMsg, 0);
                                }
                                break;

                            case 2:
                                FlagMenus(_BaseObject::Flag_Null,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);

                                m_arrayStep[nStep].bSelfFlag = false;
                                m_arrayStep[nStep].bMultipleFlag = false;
                                m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                m_arrayStep[nStep].nType = _BaseObject::Area_ShouPai | _BaseObject::Area_ZhuangBei | _BaseObject::Area_PanDing;

                                nCanChoiceCount = m_arrayPlayer[m_arrayStep[1].nSelectPlayerID].flagShouPai(_BaseObject::Flag_Enable,_Pai::Value_All);
                                nCanChoiceCount += m_arrayPlayer[m_arrayStep[1].nSelectPlayerID].flagZhuangBeiByValue(_BaseObject::Flag_Enable,_Pai::Value_All);
                                nCanChoiceCount += m_arrayPlayer[m_arrayStep[1].nSelectPlayerID].flagPanDing(_BaseObject::Flag_Enable,_Pai::Value_All);

                                if(m_arrayPlayer[player].isMe() && !m_arrayPlayer[player].m_bTuoGuan)
                                    ShowPlayersArea(m_arrayStep[1].nSelectPlayerID);

                                if(m_arrayPlayer[player].isMe())
                                {
                                    m_strMsg = m_hashGameMessage[_Pai::Value_Chai][1]
                                            .arg(_Pai::getName(_Pai::Value_Chai));
                                    ShowChuPaiMessage(m_strMsg, 0);
                                }
                                break;

                            case 3:
                                //nCanChoiceCount = 3;
                                FlagMenus(_BaseObject::Flag_Enable,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);

                                m_arrayStep[nStep].bSelfFlag = true;
                                m_arrayStep[nStep].bMultipleFlag = false;
                                m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                m_arrayStep[nStep].nType = _BaseObject::Area_Button;

                                //shortMsg = _T("使用%1")
                                //        .arg(_Pai::getName(_Pai::Value_Chai));
                                break;

                            default:
                                emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR Value_Chai Step!"));
                                setGameStatus(Game_Status_ERROR);
                                return -1;
                            }
                            break;

                        case _Pai::Value_WuZhong: //无中
                            switch(nStep)        //第几步
                            {
                            case 1:
                                //nCanChoiceCount = 3;
                                FlagMenus(_BaseObject::Flag_Enable,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);

                                m_arrayStep[nStep].bSelfFlag = true;
                                m_arrayStep[nStep].bMultipleFlag = false;
                                m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                m_arrayStep[nStep].nType = _BaseObject::Area_Button;

                                //shortMsg = _T("使用%1")
                                //        .arg(_Pai::getName(_Pai::Value_WuZhong));
                                break;

                            default:
                                emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR Value_WuZhong Step!"));
                                setGameStatus(Game_Status_ERROR);
                                return -1;
                            }
                            break;

                        case _Pai::Value_JieDao:      //借刀
                            switch(nStep)        //第几步
                            {
                            case 1:
                                FlagMenus(_BaseObject::Flag_Null,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);

                                m_arrayStep[nStep].bSelfFlag = false;
                                m_arrayStep[nStep].bMultipleFlag = false;
                                m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                m_arrayStep[nStep].nType = _BaseObject::Area_Player;

                                nCanChoiceCount = EnableAllPlayersByZhuangBei(player,_Pai::Value_All);

                                /*
                                int i = GetNextPlayer(player);
                                for(; i != player; i = GetNextPlayer(i))
                                {
                                    if(m_arrayPlayer[i].getZhuangBeiData(_BaseObject::Area_WuQi) == nullptr)continue;
                                    m_arrayPlayer[i].setSomeFlags(_BaseObject::Flag_Enable);
                                    nCanChoiceCount ++;
                                }*/

                                if(m_arrayPlayer[player].isMe())
                                {
                                    m_strMsg = m_hashGameMessage[_Pai::Value_JieDao][0]
                                            .arg(_Pai::getName(_Pai::Value_JieDao));
                                    ShowChuPaiMessage(m_strMsg, 0);
                                }
                                break;

                            case 2:
                                FlagMenus(_BaseObject::Flag_Null,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);

                                m_arrayStep[nStep].bSelfFlag = false;
                                m_arrayStep[nStep].bMultipleFlag = false;
                                m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                m_arrayStep[nStep].nType = _BaseObject::Area_Player;

                                FlagAllPlayers(_BaseObject::Flag_Null, _BaseObject::FlagType_Set, m_arrayStep[1].nSelectPlayerID);
                                nCanChoiceCount = EnableAllPlayersByDistent(m_arrayStep[1].nSelectPlayerID,2);

                                if(m_arrayPlayer[player].isMe())
                                {
                                    m_strMsg = m_hashGameMessage[_Pai::Value_JieDao][1]
                                            .arg(_Pai::getName(_Pai::Value_JieDao));
                                    ShowChuPaiMessage(m_strMsg, 0);
                                }
                                break;

                            case 3:
                                //nCanChoiceCount = 3;
                                FlagMenus(_BaseObject::Flag_Enable,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);

                                m_arrayStep[nStep].bSelfFlag = true;
                                m_arrayStep[nStep].bMultipleFlag = false;
                                m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                m_arrayStep[nStep].nType = _BaseObject::Area_Button;

                                //shortMsg = _T("使用%1")
                                //        .arg(_Pai::getName(_Pai::Value_Sha));
                                break;

                            default:
                                emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR Value_JieDao Step!"));
                                setGameStatus(Game_Status_ERROR);
                                return -1;
                            }
                            break;
                        case _Pai::Value_WanJian: //万剑
                            switch(nStep)
                            {
                            case 1:
                                //nCanChoiceCount = 3;
                                FlagMenus(_BaseObject::Flag_Enable,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);

                                m_arrayStep[nStep].bSelfFlag = true;
                                m_arrayStep[nStep].bMultipleFlag = false;
                                m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                m_arrayStep[nStep].nType = _BaseObject::Area_Button;

                                //shortMsg = _T("使用%1")
                                //        .arg(_Pai::getName(_Pai::Value_WanJian));
                                break;

                            default:
                                emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR Value_WanJian Step!"));
                                setGameStatus(Game_Status_ERROR);
                                return -1;
                            }
                            break;

                        case _Pai::Value_NanMan:  //南蛮
                            switch(nStep)
                            {
                            case 1:
                                //nCanChoiceCount = 3;
                                FlagMenus(_BaseObject::Flag_Enable,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);

                                m_arrayStep[nStep].bSelfFlag = true;
                                m_arrayStep[nStep].bMultipleFlag = false;
                                m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                m_arrayStep[nStep].nType = _BaseObject::Area_Button;

                                //shortMsg = _T("使用%1")
                                //        .arg(_Pai::getName(_Pai::Value_NanMan));
                                break;

                            default:
                                emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR Value_NanMan Step!"));
                                setGameStatus(Game_Status_ERROR);
                                return -1;
                            }
                            break;

                        case _Pai::Value_GaoKao:    //高考
                            switch(nStep)        //第几步
                            {
                            case 1:
                                FlagMenus(_BaseObject::Flag_Null,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);

                                m_arrayStep[nStep].bSelfFlag = false;
                                m_arrayStep[nStep].bMultipleFlag = false;
                                m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                m_arrayStep[nStep].nType = _BaseObject::Area_Player;

                                nCanChoiceCount = FlagAllPlayers(_BaseObject::Flag_Enable,_BaseObject::FlagType_Add,player);

                                if(m_arrayPlayer[player].isMe())
                                {
                                    m_strMsg = m_hashGameMessage[_Pai::Value_GaoKao][0]
                                            .arg(_Pai::getName(_Pai::Value_GaoKao));
                                    ShowChuPaiMessage(m_strMsg, 0);
                                }
                                break;

                            case 2:
                                //nCanChoiceCount = 3;
                                FlagMenus(_BaseObject::Flag_Enable,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);

                                m_arrayStep[nStep].bSelfFlag = true;
                                m_arrayStep[nStep].bMultipleFlag = false;
                                m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                m_arrayStep[nStep].nType = _BaseObject::Area_Button;

                                //shortMsg = _T("使用%1")
                                //        .arg(_Pai::getName(_Pai::Value_GaoKao));
                                break;

                            default:
                                emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR Value_GaoKao Step!"));
                                setGameStatus(Game_Status_ERROR);
                                return -1;
                            }
                            break;
                        case _Pai::Value_ShanDian:    //选的是闪电
                            switch(nStep)        //第几步
                            {
                            case 1:
                                //nCanChoiceCount = 3;
                                FlagMenus(_BaseObject::Flag_Enable,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);

                                m_arrayStep[nStep].bSelfFlag = true;
                                m_arrayStep[nStep].bMultipleFlag = false;
                                m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                m_arrayStep[nStep].nType = _BaseObject::Area_Button;

                                //shortMsg = _T("使用%1")
                                //        .arg(_Pai::getName(_Pai::Value_ShanDian));
                                break;

                            default:
                                emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR Value_ShanDian Step!"));
                                setGameStatus(Game_Status_ERROR);
                                return -1;
                            }
                            break;

                        case _Pai::Value_LeBuSiShu:   //乐不思蜀
                        switch(nStep)        //第几步
                        {
                        case 1:
                            FlagMenus(_BaseObject::Flag_Null,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);

                            m_arrayStep[nStep].bSelfFlag = false;
                            m_arrayStep[nStep].bMultipleFlag = false;
                            m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                            m_arrayStep[nStep].nType = _BaseObject::Area_Player;


                            nCanChoiceCount = FlagAllPlayers(_BaseObject::Flag_Enable,_BaseObject::FlagType_Set,player);
                            nCanChoiceCount -= FlagAllPlayersByPanDing(_BaseObject::Flag_Null,_Pai::Value_LeBuSiShu);

                            if(m_arrayPlayer[player].isMe())
                            {
                                m_strMsg = m_hashGameMessage[_Pai::Value_LeBuSiShu][0]
                                        .arg(_Pai::getName(_Pai::Value_LeBuSiShu));
                                ShowChuPaiMessage(m_strMsg, 0);
                            }
                            break;

                        case 2:
                            //nCanChoiceCount = 3;
                            FlagMenus(_BaseObject::Flag_Enable,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);

                            m_arrayStep[nStep].bSelfFlag = true;
                            m_arrayStep[nStep].bMultipleFlag = false;
                            m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                            m_arrayStep[nStep].nType = _BaseObject::Area_Button;

                            //shortMsg = _T("使用%1")
                            //        .arg(_Pai::getName(_Pai::Value_LeBuSiShu));
                            break;

                        default:
                            emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR Value_LeBuSiShu Step!"));
                            setGameStatus(Game_Status_ERROR);
                            return -1;
                            }
                            break;

                        case _Pai::Value_LianNu:                //选的是 手牌里的 武器
                        case _Pai::Value_ZhangBa:
                        case _Pai::Value_QingLong:
                        case _Pai::Value_GuanShiFu:
                        case _Pai::Value_HanBing:
                        case _Pai::Value_TanSu:
                            switch(nStep)        //第几步
                            {
                            case 1:
                                //nCanChoiceCount = 3;
                                FlagMenus(_BaseObject::Flag_Enable,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);

                                m_arrayStep[nStep].bSelfFlag = true;
                                m_arrayStep[nStep].bMultipleFlag = false;
                                m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                m_arrayStep[nStep].nType = _BaseObject::Area_Button;

                                //shortMsg = m_hashGameMessage[_Pai::Value_LianNu][0]
                                //        .arg(_Pai::getName(m_arrayPlayer[player].getShouPaiData(step[0].nSelectValue[0])->value()));
                                break;

                            default:
                                emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR ShouPai Step!"));
                                setGameStatus(Game_Status_ERROR);
                                return -1;
                            }
                            break;

                        default:
                            emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR 2!"));
                            setGameStatus(Game_Status_ERROR);
                            return -1;
                        }
                    }
                    else if(m_arrayStep[0].nSelectType[0] == _BaseObject::Area_JiNeng)        //选的是技能
                    {
                        switch(m_arrayPlayer[player].getJiNengPaiData(m_arrayStep[0].nSelectValue[0])->value())
                        {
                        case _Pai::Value_JiNeng_ZhanZhengZhiShen:
                            switch(nStep)        //第几步
                            {
                            case 1:
                                FlagMenus(_BaseObject::Flag_Null,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);

                                FlagAllPlayers(_BaseObject::Flag_Null, _BaseObject::FlagType_Set, -1);

                                m_arrayPlayer[player].flagShouPai(_BaseObject::Flag_Null,_Pai::Value_All);
                                nCanChoiceCount = m_arrayPlayer[player].flagShouPai(_BaseObject::Flag_Enable,_Pai::Value_Sha);

                                m_arrayStep[nStep].bSelfFlag = true;
                                m_arrayStep[nStep].bMultipleFlag = false;
                                m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                m_arrayStep[nStep].nType = _BaseObject::Area_ShouPai;

                                if(m_arrayPlayer[player].isMe())
                                {
                                    m_strMsg = _T("技能 %1 发动，请选择一张 %2")
                                            .arg(_JiNeng::getName(_JiNeng::JiNengValue_ZhanZhengZhiShen))
                                            .arg(_Pai::getName(_Pai::Value_Sha));
                                    ShowChuPaiMessage(m_strMsg, 0);
                                }
                                break;

                            case 2:
                                FlagMenus(_BaseObject::Flag_Null,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);

                                m_arrayStep[nStep].bSelfFlag = false;
                                m_arrayStep[nStep].bMultipleFlag = false;
                                m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                m_arrayStep[nStep].nType = _BaseObject::Area_Player;

                                FlagAllPlayers(_BaseObject::Flag_Null, _BaseObject::FlagType_Set, -1);
                                nCanChoiceCount = EnableAllPlayersByDistent(player,2);

                                if(m_arrayPlayer[player].isMe())
                                {
                                    m_strMsg = m_hashGameMessage[_Pai::Value_GaoKao][0]
                                            .arg(_Pai::getName(_Pai::Value_GaoKao));
                                    ShowChuPaiMessage(m_strMsg, 0);
                                }
                                break;

                            case 3:
                                //nCanChoiceCount = 3;
                                FlagMenus(_BaseObject::Flag_Enable,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);

                                m_arrayStep[nStep].bSelfFlag = true;
                                m_arrayStep[nStep].bMultipleFlag = false;
                                m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                m_arrayStep[nStep].nType = _BaseObject::Area_Button;

                                //shortMsg = _T("%1确定?")
                                //        .arg(_Pai::getName(_Pai::Value_Sha));
                                break;

                            default:
                                emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR Value_JiNeng_ZhanZhengZhiShen!"));
                                setGameStatus(Game_Status_ERROR);
                                return -1;
                            }
                            break;

                        case _Pai::Value_JiNeng_MengNaLiSha:
                            switch(nStep)        //第几步
                            {
                            case 1:
                                FlagMenus(_BaseObject::Flag_Null,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);

                                FlagAllPlayers(_BaseObject::Flag_Null,_BaseObject::FlagType_Set);

                                m_arrayPlayer[player].flagShouPai(_BaseObject::Flag_Null,_Pai::Value_All);
                                nCanChoiceCount = m_arrayPlayer[player].flagShouPai(_BaseObject::Flag_Enable,_Pai::Value_All);

                                m_arrayStep[nStep].bSelfFlag = true;
                                m_arrayStep[nStep].bMultipleFlag = false;
                                m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                m_arrayStep[nStep].nType = _BaseObject::Area_ShouPai;

                                if(m_arrayPlayer[player].isMe())
                                {
                                    m_strMsg = _T("技能 %1 发动，请选择一张手牌")
                                            .arg(_Pai::getName(_Pai::Value_JiNeng_MengNaLiSha));
                                    ShowChuPaiMessage(m_strMsg, 0);
                                }
                                break;

                            case 2:
                                FlagMenus(_BaseObject::Flag_Null,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);

                                m_arrayStep[nStep].bSelfFlag = false;
                                m_arrayStep[nStep].bMultipleFlag = false;
                                m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                m_arrayStep[nStep].nType = _BaseObject::Area_Player;

                                FlagAllPlayers(_BaseObject::Flag_Null, _BaseObject::FlagType_Set, -1);
                                nCanChoiceCount = EnableAllPlayersByDistent(player,2);

                                if(m_arrayPlayer[player].isMe())
                                {
                                    m_strMsg = _T("技能 %1 发动，请选择一名角色")
                                            .arg(_Pai::getName(_Pai::Value_JiNeng_MengNaLiSha));
                                    ShowChuPaiMessage(m_strMsg, 0);
                                }
                                break;

                            case 3:
                                FlagMenus(_BaseObject::Flag_Enable,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);

                                m_arrayStep[nStep].bSelfFlag = true;
                                m_arrayStep[nStep].bMultipleFlag = false;
                                m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                m_arrayStep[nStep].nType = _BaseObject::Area_Button;

                                //shortMsg = _T("%1确定?")
                                //        .arg(_Pai::getName(_Pai::Value_Sha));
                                break;

                            default:
                                emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR Value_JiNeng_MengNaLiSha!"));
                                setGameStatus(Game_Status_ERROR);
                                return -1;
                            }
                            break;

                        case _Pai::Value_JiNeng_KaiSa:
                            switch(nStep)        //第几步
                            {
                            case 1:
                                FlagMenus(_BaseObject::Flag_Null,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);

                                FlagAllPlayers(_BaseObject::Flag_Null,_BaseObject::FlagType_Set);

                                m_arrayPlayer[player].flagShouPai(_BaseObject::Flag_Null,_Pai::Value_All);
                                nCanChoiceCount = m_arrayPlayer[player].flagShouPai(_BaseObject::Flag_Enable,_Pai::Value_GaoKao);

                                m_arrayStep[nStep].bSelfFlag = true;
                                m_arrayStep[nStep].bMultipleFlag = false;
                                m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                m_arrayStep[nStep].nType = _BaseObject::Area_ShouPai;

                                if(m_arrayPlayer[player].isMe())
                                {
                                    m_strMsg = _T("技能 %1 发动，请选择一张 %2")
                                            .arg(_JiNeng::getName(_JiNeng::JiNengValue_KaiSa))
                                            .arg(_Pai::getName(_Pai::Value_GaoKao));
                                    ShowChuPaiMessage(m_strMsg, 0);
                                }
                                break;

                            case 2:
                                FlagMenus(_BaseObject::Flag_Null,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);

                                m_arrayStep[nStep].bSelfFlag = false;
                                m_arrayStep[nStep].bMultipleFlag = false;
                                m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                m_arrayStep[nStep].nType = _BaseObject::Area_Player;

                                nCanChoiceCount = FlagAllPlayers(_BaseObject::Flag_Enable,_BaseObject::FlagType_Add,player);

                                if(m_arrayPlayer[player].isMe())
                                {
                                    m_strMsg = m_hashGameMessage[_Pai::Value_GaoKao][0]
                                            .arg(_Pai::getName(_Pai::Value_GaoKao));
                                    ShowChuPaiMessage(m_strMsg, 0);
                                }
                                break;

                            case 3:
                                //nCanChoiceCount = 3;
                                FlagMenus(_BaseObject::Flag_Enable,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);

                                m_arrayStep[nStep].bSelfFlag = true;
                                m_arrayStep[nStep].bMultipleFlag = false;
                                m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                m_arrayStep[nStep].nType = _BaseObject::Area_Button;

                                //shortMsg = _T("%1确定?")
                                //        .arg(_Pai::getName(_Pai::Value_Sha));
                                break;

                            default:
                                emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR Value_JiNeng_KaiSa!"));
                                setGameStatus(Game_Status_ERROR);
                                return -1;
                            }
                            break;

                        default:
                            emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR Sha 83!"));
                            setGameStatus(Game_Status_ERROR);
                            return -1;

                        }
                    }
                    else
                    {
                        emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR Sha 43!"));
                        setGameStatus(Game_Status_ERROR);
                        return -1;
                    }
                }
                break;
            }
        }
        break;


    case GameCore::Game_ChuPai_Type_Pai:
        {
            switch(nValue)
            {
            case _Pai::Value_Sha:  //nParam1/2为个数,nParam3为发动的技能
                {
                    switch(nStep)
                    {
                    case 0:
                        FlagMenus(_BaseObject::Flag_Null,_BaseObject::Flag_Enable,_BaseObject::Flag_Null);

                        FlagAllPlayers(_BaseObject::Flag_Null,_BaseObject::FlagType_Set);

                        m_arrayPlayer[player].flagShouPai(_BaseObject::Flag_Null,_Pai::Value_All);
                        nCanChoiceCount = m_arrayPlayer[player].flagShouPai(_BaseObject::Flag_Enable,_Pai::Value_Sha);

                        //如果只需要1张杀
                        if(nParam1 == 1)
                        {
                            nCanChoiceCount += m_arrayPlayer[player].flagZhuangBeiByValue(_BaseObject::Flag_Enable,_Pai::Value_ZhangBa);
                            nCanChoiceCount += m_arrayPlayer[player].flagZhuangBeiByValue(_BaseObject::Flag_Enable,_Pai::Value_TanSu);

                            nCanChoiceCount += m_arrayPlayer[player].flagJiNengPai(_BaseObject::Flag_Enable, _Pai::Value_JiNeng_MengNaLiSha);

                            QList<QVariant> listJiNeng = nParam3.toList();
                            if(listJiNeng.contains(QVariant::fromValue<int>(_JiNeng::JiNengValue_ZuoYongLi)))
                                nCanChoiceCount += m_arrayPlayer[player].flagJiNengPai(_BaseObject::Flag_Enable, _Pai::Value_JiNeng_ZuoYongLi);
                        }

                        m_arrayStep[nStep].bSelfFlag = true;
                        m_arrayStep[nStep].bMultipleFlag = false;
                        m_arrayStep[nStep].nMinCount = nParam1;
                        m_arrayStep[nStep].nMaxCount = nParam2;
                        m_arrayStep[nStep].nType = _BaseObject::Area_ShouPai | _BaseObject::Area_ZhuangBei | _BaseObject::Area_JiNeng;

                        if(m_arrayPlayer[player].isMe())
                        {
                            ShowChuPaiMessage(strMsg, 0);
                        }
                        break;

                    //第一步选的是 武器 还是 手牌 还是 技能 杀
                    default:
                        {
                            if(m_arrayStep[0].nSelectType[0] == _BaseObject::Area_ZhuangBei)        //选的是武器
                            {
                                switch(m_arrayPlayer[player].getZhuangBeiData((_BaseObject::_Area)m_arrayStep[0].nSelectValue[0])->value())
                                {
                                case _Pai::Value_ZhangBa:
                                    switch(nStep)        //第几步
                                    {
                                    case 1:
                                        nCanChoiceCount = ChuPai_ZhangBa(player,eType,nStep);
                                        break;

                                    case 2:
                                        //nCanChoiceCount = 2;
                                        FlagMenus(_BaseObject::Flag_Enable,_BaseObject::Flag_Enable,_BaseObject::Flag_Null);

                                        m_arrayStep[nStep].bSelfFlag = true;
                                        m_arrayStep[nStep].bMultipleFlag = false;
                                        m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                        m_arrayStep[nStep].nType = _BaseObject::Area_Button;

                                        //shortMsg = _T("%1确定?")
                                        //        .arg(_Pai::getName(_Pai::Value_Sha));
                                        break;
                                    default:
                                        emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR Value_ZhangBa!"));
                                        setGameStatus(Game_Status_ERROR);
                                        return -1;
                                    }
                                    break;

                                case _Pai::Value_TanSu:
                                    switch(nStep)        //第几步
                                    {
                                    case 1:
                                        nCanChoiceCount = ChuPai_TanSu(player,eType,nStep);
                                        break;
                                    case 2:
                                        //nCanChoiceCount = 2;
                                        FlagMenus(_BaseObject::Flag_Enable,_BaseObject::Flag_Enable,_BaseObject::Flag_Null);

                                        m_arrayStep[nStep].bSelfFlag = true;
                                        m_arrayStep[nStep].bMultipleFlag = false;
                                        m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                        m_arrayStep[nStep].nType = _BaseObject::Area_Button;

                                        //shortMsg = _T("%1确定?")
                                        //        .arg(_Pai::getName(_Pai::Value_Sha));
                                        break;
                                    default:
                                        emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR Value_TanSu!"));
                                        setGameStatus(Game_Status_ERROR);
                                        return -1;
                                    }
                                    break;

                                default:
                                    emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR Sha!"));
                                    setGameStatus(Game_Status_ERROR);
                                    return -1;
                                }
                            }
                            else if(m_arrayStep[0].nSelectType[0] == _BaseObject::Area_ShouPai)    //选的是手牌
                            {
                                switch(m_arrayPlayer[player].getShouPaiData(m_arrayStep[0].nSelectValue[0])->value())
                                {
                                case _Pai::Value_Sha:                //选的是杀
                                    switch(nStep)        //第几步
                                    {
                                    case 1:
                                        //nCanChoiceCount = 3;
                                        FlagMenus(_BaseObject::Flag_Enable,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);

                                        m_arrayStep[nStep].bSelfFlag = true;
                                        m_arrayStep[nStep].bMultipleFlag = false;
                                        m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                        m_arrayStep[nStep].nType = _BaseObject::Area_Button;

                                        //shortMsg = _T("%1确定?")
                                        //        .arg(_Pai::getName(_Pai::Value_Sha));
                                        break;
                                    default:
                                        emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR Value_Sha Step 2!"));
                                        setGameStatus(Game_Status_ERROR);
                                        return -1;
                                    }
                                    break;
                                default:
                                    emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR Sha 2!"));
                                    setGameStatus(Game_Status_ERROR);
                                    return -1;
                                }
                            }
                            else if(m_arrayStep[0].nSelectType[0] == _BaseObject::Area_JiNeng)    //选的是手牌
                            {
                                switch(m_arrayPlayer[player].getJiNengPaiData(m_arrayStep[0].nSelectValue[0])->value())
                                {
                                case _Pai::Value_JiNeng_MengNaLiSha:
                                    switch(nStep)        //第几步
                                    {
                                    case 1:
                                        FlagMenus(_BaseObject::Flag_Null,_BaseObject::Flag_Enable,_BaseObject::Flag_Null);
                                        FlagAllPlayers(_BaseObject::Flag_Null,_BaseObject::FlagType_Set);

                                        m_arrayPlayer[player].flagZhuangBeiByArea(_BaseObject::Flag_Null,_BaseObject::Area_WuQi,_BaseObject::FlagType_Set);

                                        nCanChoiceCount = m_arrayPlayer[player].flagShouPai(_BaseObject::Flag_Enable,_Pai::Value_All);

                                        m_arrayStep[nStep].bSelfFlag = true;
                                        m_arrayStep[nStep].bMultipleFlag = false;
                                        m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                        m_arrayStep[nStep].nType = _BaseObject::Area_ShouPai;

                                        if(m_arrayPlayer[player].isMe())
                                        {
                                            m_strMsg = _T("技能 %1 发动，请选择一张手牌")
                                                    .arg(_Pai::getName(_Pai::Value_JiNeng_MengNaLiSha));
                                            ShowChuPaiMessage(m_strMsg, 0);
                                        }

                                        break;

                                    case 2:
                                        //nCanChoiceCount = 2;
                                        FlagMenus(_BaseObject::Flag_Enable,_BaseObject::Flag_Enable,_BaseObject::Flag_Null);

                                        m_arrayStep[nStep].bSelfFlag = true;
                                        m_arrayStep[nStep].bMultipleFlag = false;
                                        m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                        m_arrayStep[nStep].nType = _BaseObject::Area_Button;

                                        //shortMsg = _T("选择确定可以弃掉对方任意两张手牌，取消则继续造成伤害");
                                        break;

                                    default:
                                        emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR ShenQu 2!"));
                                        setGameStatus(Game_Status_ERROR);
                                        return -1;
                                    }
                                    break;

                                case _Pai::Value_JiNeng_ZuoYongLi:
                                    switch(nStep)        //第几步
                                    {
                                    case 1:
                                        FlagMenus(_BaseObject::Flag_Null,_BaseObject::Flag_Enable,_BaseObject::Flag_Null);
                                        FlagAllPlayers(_BaseObject::Flag_Null,_BaseObject::FlagType_Set);

                                        m_arrayPlayer[player].flagZhuangBeiByArea(_BaseObject::Flag_Null,_BaseObject::Area_WuQi,_BaseObject::FlagType_Set);

                                        nCanChoiceCount = m_arrayPlayer[player].flagShouPai(_BaseObject::Flag_Enable,_Pai::Value_All);

                                        m_arrayStep[nStep].bSelfFlag = true;
                                        m_arrayStep[nStep].bMultipleFlag = false;
                                        m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                        m_arrayStep[nStep].nType = _BaseObject::Area_ShouPai;

                                        if(m_arrayPlayer[player].isMe())
                                        {
                                            m_strMsg = _T("技能 %1 发动，请选择一张手牌")
                                                    .arg(_Pai::getName(_Pai::Value_JiNeng_ZuoYongLi));
                                            ShowChuPaiMessage(m_strMsg, 0);
                                        }

                                        break;

                                    case 2:
                                        //nCanChoiceCount = 2;
                                        FlagMenus(_BaseObject::Flag_Enable,_BaseObject::Flag_Enable,_BaseObject::Flag_Null);

                                        m_arrayStep[nStep].bSelfFlag = true;
                                        m_arrayStep[nStep].bMultipleFlag = false;
                                        m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                        m_arrayStep[nStep].nType = _BaseObject::Area_Button;

                                        //shortMsg = _T("选择确定可以弃掉对方任意两张手牌，取消则继续造成伤害");
                                        break;

                                    default:
                                        emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR ShenQu 2!"));
                                        setGameStatus(Game_Status_ERROR);
                                        return -1;
                                    }
                                    break;

                                default:
                                    emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR Sha 8234!"));
                                    setGameStatus(Game_Status_ERROR);
                                    return -1;

                                }
                            }
                            else
                            {
                                emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR Sha 38!"));
                                setGameStatus(Game_Status_ERROR);
                                return -1;
                            }
                        }
                        break;
                    }
                }
                break;

            case _Pai::Value_Shan:  //nParam1/2为个数
                {
                    switch(nStep)
                    {
                    case 0:
                        FlagMenus(_BaseObject::Flag_Null,_BaseObject::Flag_Enable,_BaseObject::Flag_Null);

                        FlagAllPlayers(_BaseObject::Flag_Null,_BaseObject::FlagType_Set);

                        m_arrayPlayer[player].flagShouPai(_BaseObject::Flag_Null,_Pai::Value_All);
                        nCanChoiceCount = m_arrayPlayer[player].flagShouPai(_BaseObject::Flag_Enable,_Pai::Value_Shan);            //闪

                        if(nParam1 == 1)
                        {
                            m_arrayStep[nStep].bMultipleFlag = false;

                            //技能 神曲
                            if(nCanChoiceCount == 0)
                            {
                                nCanChoiceCount = m_arrayPlayer[player].flagJiNengPai(_BaseObject::Flag_Enable, _Pai::Value_JiNeng_ShenQu);
                            }
                        }
                        else
                            m_arrayStep[nStep].bMultipleFlag = true;

                        m_arrayStep[nStep].bSelfFlag = true;
                        m_arrayStep[nStep].nMinCount = nParam1;
                        m_arrayStep[nStep].nMaxCount = nParam2;
                        m_arrayStep[nStep].nType = _BaseObject::Area_ShouPai | _BaseObject::Area_ZhuangBei | _BaseObject::Area_JiNeng;

                        if(m_arrayPlayer[player].isMe())
                        {
                            /*m_strMsg = //m_strMsg + _T("，") +
                                    m_hashGameMessage[_Pai::Value_Shan][0]
                                    .arg(nParam1)
                                    .arg(_Pai::getName(_Pai::Value_Shan));
                            ShowChuPaiMessage(m_strMsg, 0);
                            */
                            ShowChuPaiMessage(strMsg, 0);
                        }
                        break;

                    default:
                        {
                            if(m_arrayStep[0].nSelectType[0] == _BaseObject::Area_ShouPai)    //选的是手牌
                            {
                                switch(m_arrayPlayer[player].getShouPaiData(m_arrayStep[0].nSelectValue[0])->value())
                                {
                                case _Pai::Value_Shan:                //选的是闪
                                    switch(nStep)        //第几步
                                    {
                                    case 1:
                                        //nCanChoiceCount = 2;
                                        FlagMenus(_BaseObject::Flag_Enable,_BaseObject::Flag_Enable,_BaseObject::Flag_Null);

                                        m_arrayStep[nStep].bSelfFlag = true;
                                        m_arrayStep[nStep].bMultipleFlag = false;
                                        m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                        m_arrayStep[nStep].nType = _BaseObject::Area_Button;

                                        //shortMsg = _T("%1确定?")
                                        //        .arg(_Pai::getName(_Pai::Value_Shan));
                                        break;

                                    default:
                                        emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR Value_Shan Step 2!"));
                                        setGameStatus(Game_Status_ERROR);
                                        return -1;
                                    }
                                    break;

                                default:
                                    emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR Shan 2!"));
                                    setGameStatus(Game_Status_ERROR);
                                    return -1;
                                }
                            }
                            else if(m_arrayStep[0].nSelectType[0] == _BaseObject::Area_ZhuangBei)        //选的是武器
                            {
                                /*
                                switch(m_arrayPlayer[player].getZhuangBeiData((_BaseObject::_Area)m_arrayStep[0].nSelectValue[0])->value())
                                {
                                case _Pai::Value_ZhangBa:
                                    {
                                        switch(nStep)        //第几步
                                        {
                                        case 1:
                                            {
                                                nCanChoiceCount = ChuPai_ZhangBa(player,eType,nStep);
                                            }
                                            break;
                                        }
                                    }
                                    break;
                                default:
                                    emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR Shan!"));
                                    setGameStatus(Game_Status_ERROR);
                                    return -1;
                                }
                                */
                                emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR Shan 3!"));
                                setGameStatus(Game_Status_ERROR);
                            }

                            else if(m_arrayStep[0].nSelectType[0] == _BaseObject::Area_JiNeng)    //选的是手牌
                            {
                                switch(m_arrayPlayer[player].getJiNengPaiData(m_arrayStep[0].nSelectValue[0])->value())
                                {
                                case _Pai::Value_JiNeng_ShenQu:
                                    switch(nStep)        //第几步
                                    {
                                    case 1:
                                        FlagMenus(_BaseObject::Flag_Null,_BaseObject::Flag_Enable,_BaseObject::Flag_Null);
                                        FlagAllPlayers(_BaseObject::Flag_Null,_BaseObject::FlagType_Set);

                                        m_arrayPlayer[player].flagZhuangBeiByArea(_BaseObject::Flag_Null,_BaseObject::Area_WuQi,_BaseObject::FlagType_Set);

                                        nCanChoiceCount = m_arrayPlayer[player].flagShouPai(_BaseObject::Flag_Enable,_Pai::Value_All);

                                        m_arrayStep[nStep].bSelfFlag = true;
                                        m_arrayStep[nStep].bMultipleFlag = false;
                                        m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                        m_arrayStep[nStep].nType = _BaseObject::Area_ShouPai;

                                        if(m_arrayPlayer[player].isMe())
                                        {
                                            m_strMsg = _T("技能 %1 发动，请选择一张手牌")
                                                    .arg(_Pai::getName(_Pai::Value_JiNeng_ShenQu));
                                            ShowChuPaiMessage(m_strMsg, 0);
                                        }

                                        break;

                                    case 2:
                                        //nCanChoiceCount = 2;
                                        FlagMenus(_BaseObject::Flag_Enable,_BaseObject::Flag_Enable,_BaseObject::Flag_Null);

                                        m_arrayStep[nStep].bSelfFlag = true;
                                        m_arrayStep[nStep].bMultipleFlag = false;
                                        m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                                        m_arrayStep[nStep].nType = _BaseObject::Area_Button;

                                        //shortMsg = _T("选择确定可以弃掉对方任意两张手牌，取消则继续造成伤害");
                                        break;

                                    default:
                                        emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR ShenQu!"));
                                        setGameStatus(Game_Status_ERROR);
                                        return -1;
                                    }
                                    break;

                                default:
                                    emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR JiNeng!"));
                                    setGameStatus(Game_Status_ERROR);
                                    return -1;
                                }
                            }
                        }
                    }
                }
                break;

            case _Pai::Value_Tao:
                switch(nStep)
                {
                case 0:
                    FlagAllPlayers(_BaseObject::Flag_Null,_BaseObject::FlagType_Set);

                    m_arrayPlayer[player].flagShouPai(_BaseObject::Flag_Null,_Pai::Value_All);
                    nCanChoiceCount = m_arrayPlayer[player].flagShouPai(_BaseObject::Flag_Enable,_Pai::Value_Tao);            //闪
                    FlagMenus(_BaseObject::Flag_Null,_BaseObject::Flag_Enable,_BaseObject::Flag_Null);

                    m_arrayStep[nStep].bSelfFlag = true;
                    m_arrayStep[nStep].bMultipleFlag = false;
                    m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                    m_arrayStep[nStep].nType = _BaseObject::Area_ShouPai;

                    if(m_arrayPlayer[player].isMe())
                    {
                        //m_strMsg = m_hashGameMessage[_Pai::Value_Tao][0]
                        //        .arg(_Pai::getName(_Pai::Value_Tao));
                        ShowChuPaiMessage(strMsg, 0);
                    }
                    break;

                case 1:
                    //nCanChoiceCount = 2;
                    FlagMenus(_BaseObject::Flag_Enable,_BaseObject::Flag_Enable,_BaseObject::Flag_Null);

                    m_arrayStep[nStep].bSelfFlag = true;
                    m_arrayStep[nStep].bMultipleFlag = false;
                    m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                    m_arrayStep[nStep].nType = _BaseObject::Area_Button;

                    //shortMsg = _T("%1确定?")
                    //        .arg(_Pai::getName(_Pai::Value_Tao));
                    break;

                default:
                    emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR Tao!"));
                    setGameStatus(Game_Status_ERROR);
                    return -1;
                }
                break;

            case _Pai::Value_GuanShiFu:    //贯石斧 弃牌
                switch(nStep)
                {
                case 0:
                    FlagAllPlayers(_BaseObject::Flag_Null,_BaseObject::FlagType_Set);

                    m_arrayPlayer[player].flagZhuangBeiByArea(_BaseObject::Flag_Null,_BaseObject::Area_WuQi,_BaseObject::FlagType_Set);
                    nCanChoiceCount = m_arrayPlayer[player].flagShouPai(_BaseObject::Flag_Enable,_Pai::Value_All);
                    FlagMenus(_BaseObject::Flag_Null,_BaseObject::Flag_Enable,_BaseObject::Flag_Null);


                    m_arrayStep[nStep].bSelfFlag = true;
                    m_arrayStep[nStep].bMultipleFlag = true;
                    m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 2;
                    m_arrayStep[nStep].nType = _BaseObject::Area_ShouPai;

                    if(m_arrayPlayer[player].isMe())
                    {
                        m_strMsg = m_hashGameMessage[_Pai::Value_GuanShiFu][0];
                        ShowChuPaiMessage(m_strMsg, 0);
                    }

                    break;
                case 1:
                    //nCanChoiceCount = 2;
                    FlagMenus(_BaseObject::Flag_Enable,_BaseObject::Flag_Enable,_BaseObject::Flag_Null);

                    m_arrayStep[nStep].bSelfFlag = true;
                    m_arrayStep[nStep].bMultipleFlag = false;
                    m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                    m_arrayStep[nStep].nType = _BaseObject::Area_Button;

                    break;
                default:
                    emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR GuanShiFu!"));
                    setGameStatus(Game_Status_ERROR);
                    return -1;
                }
                break;

            case _Pai::Value_HanBing:   //nParam3为对方玩家下标
                switch(nStep)
                {
                case 0:
                    FlagAllPlayers(_BaseObject::Flag_Null,_BaseObject::FlagType_Set);

                    m_arrayPlayer[nParam3.toInt()].resetAllFlags();

                    nCanChoiceCount = m_arrayPlayer[nParam3.toInt()].flagZhuangBeiByArea(_BaseObject::Flag_Enable,_BaseObject::Area_WuQi,_BaseObject::FlagType_Set);
                    nCanChoiceCount += m_arrayPlayer[nParam3.toInt()].flagShouPai(_BaseObject::Flag_Enable,_Pai::Value_All);
                    nCanChoiceCount += m_arrayPlayer[nParam3.toInt()].flagPanDing(_BaseObject::Flag_Enable,_Pai::Value_All);
                    FlagMenus(_BaseObject::Flag_Null,_BaseObject::Flag_Enable,_BaseObject::Flag_Null);


                    m_arrayStep[nStep].bSelfFlag = false;
                    m_arrayStep[nStep].bMultipleFlag = true;
                    m_arrayStep[nStep].nMinCount = 1;
                    m_arrayStep[nStep].nMaxCount = 2;
                    m_arrayStep[nStep].nType = _BaseObject::Area_ShouPai | _BaseObject::Area_ZhuangBei | _BaseObject::Area_PanDing;


                    if(m_arrayPlayer[player].isMe() && !m_arrayPlayer[player].m_bTuoGuan)
                        ShowPlayersArea(nParam3.toInt());

                    if(m_arrayPlayer[player].isMe())
                    {
                        m_strMsg = m_hashGameMessage[_Pai::Value_HanBing][0];
                        ShowChuPaiMessage(m_strMsg, 0);
                    }

                    break;
                case 1:
                    //nCanChoiceCount = 2;
                    FlagMenus(_BaseObject::Flag_Enable,_BaseObject::Flag_Enable,_BaseObject::Flag_Null);

                    m_arrayStep[nStep].bSelfFlag = true;
                    m_arrayStep[nStep].bMultipleFlag = false;
                    m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                    m_arrayStep[nStep].nType = _BaseObject::Area_Button;

                    //shortMsg = _T("选择确定可以弃掉对方任意两张手牌，取消则继续造成伤害");
                    break;
                default:
                    emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR HanBing!"));
                    setGameStatus(Game_Status_ERROR);
                    return -1;
                }
                break;



            case _Pai::Value_JiNeng_KaiSa:    //凯撒 第2 功能
                //nParam3为:0(选择武将)
                switch(nParam3.toInt())
                {
                case 0:
                    switch(nStep)
                    {
                    case 3:
                        FlagMenus(_BaseObject::Flag_Null,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);

                        m_arrayStep[nStep].bSelfFlag = false;
                        m_arrayStep[nStep].bMultipleFlag = false;
                        m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                        m_arrayStep[nStep].nType = _BaseObject::Area_ShouPai | _BaseObject::Area_ZhuangBei | _BaseObject::Area_PanDing;

                        nCanChoiceCount = m_arrayPlayer[m_arrayStep[2].nSelectPlayerID].flagShouPai(_BaseObject::Flag_Enable,_Pai::Value_All);
                        nCanChoiceCount += m_arrayPlayer[m_arrayStep[2].nSelectPlayerID].flagZhuangBeiByValue(_BaseObject::Flag_Enable,_Pai::Value_All);
                        nCanChoiceCount += m_arrayPlayer[m_arrayStep[2].nSelectPlayerID].flagPanDing(_BaseObject::Flag_Enable,_Pai::Value_All);

                        if(m_arrayPlayer[player].isMe() && !m_arrayPlayer[player].m_bTuoGuan)
                            ShowPlayersArea(m_arrayStep[2].nSelectPlayerID);

                        if(m_arrayPlayer[player].isMe())
                        {
                            m_strMsg = _T("技能 %1 发动，请选择一张牌")
                                    .arg(_JiNeng::getName(_JiNeng::JiNengValue_KaiSa));
                            ShowChuPaiMessage(m_strMsg, 0);
                        }
                        break;
                    case 4:
                        //nCanChoiceCount = 2;
                        FlagMenus(_BaseObject::Flag_Enable,_BaseObject::Flag_Enable,_BaseObject::Flag_Null);

                        m_arrayStep[nStep].bSelfFlag = true;
                        m_arrayStep[nStep].bMultipleFlag = false;
                        m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                        m_arrayStep[nStep].nType = _BaseObject::Area_Button;

                        //shortMsg = _T("使用%1")
                        //        .arg(_Pai::getName(_Pai::Value_Sha));
                        break;

                    default:
                        emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR KaiSa!"));
                        setGameStatus(Game_Status_ERROR);
                        return -1;
                    }
                    break;
                }
                break;

            default:
                emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR ChuPai_Type_Pai!"));
                setGameStatus(Game_Status_ERROR);
                return -1;
            }
        }
        break;


    case GameCore::Game_ChuPai_Type_JiNeng:
        {
            switch(nValue)
            {
            /*
            case _JiNeng::JiNengValue_ShenQu:
                {
                    switch(nStep)
                    {
                    case 0:
                        {
                            FlagAllPlayers(_BaseObject::Flag_Null,_BaseObject::FlagType_Set);

                            nCanChoiceCount = m_arrayPlayer[player].flagShouPai(_BaseObject::Flag_Enable,_Pai::Value_All);
                            FlagMenus(_BaseObject::Flag_Null,_BaseObject::Flag_Enable,_BaseObject::Flag_Null);

                            m_arrayStep[nStep].bSelfFlag = true;
                            m_arrayStep[nStep].bMultipleFlag = false;
                            m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                            m_arrayStep[nStep].nType = _BaseObject::Area_ShouPai;

                            if(m_arrayPlayer[player].isMe())
                            {
                                m_strMsg = _T("技能 %1 发动，请选择一张手牌")
                                        .arg(_JiNeng::getName(_JiNeng::JiNengValue_ShenQu));
                                ShowChuPaiMessage(m_strMsg, 0);
                            }
                        }
                        break;
                    case 1:
                        {
                            //nCanChoiceCount = 2;
                            FlagMenus(_BaseObject::Flag_Enable,_BaseObject::Flag_Enable,_BaseObject::Flag_Null);

                            m_arrayStep[nStep].bSelfFlag = true;
                            m_arrayStep[nStep].bMultipleFlag = false;
                            m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                            m_arrayStep[nStep].nType = _BaseObject::Area_Button;

                            //shortMsg = _T("使用%1")
                            //        .arg(_Pai::getName(_Pai::Value_Sha));
                        }
                        break;
                    }
                }
                break;
            */

            case _JiNeng::JiNengValue_DaHangHaiShiDai:
                //nParam3为:0(是否发动);1(发动步骤)
                switch(nParam3.toInt())
                {
                case 0:
                    //nCanChoiceCount = 2;
                    FlagAllPlayers(_BaseObject::Flag_Null,_BaseObject::FlagType_Set);

                    m_arrayPlayer[player].flagShouPai(_BaseObject::Flag_Null,_Pai::Value_All);
                    FlagMenus(_BaseObject::Flag_Enable,_BaseObject::Flag_Enable,_BaseObject::Flag_Null);

                    m_arrayStep[nStep].bSelfFlag = true;
                    m_arrayStep[nStep].bMultipleFlag = false;
                    m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                    m_arrayStep[nStep].nType = _BaseObject::Area_Button;

                    if(m_arrayPlayer[player].isMe())
                    {
                        m_strMsg = _T("是否发动技能 %1")
                                .arg(_JiNeng::getName(_JiNeng::JiNengValue_DaHangHaiShiDai));
                        ShowChuPaiMessage(m_strMsg, 0);
                    }
                    break;

                case 1:
                    switch(nStep)
                    {
                    case 0:
                        FlagAllPlayers(_BaseObject::Flag_Null,_BaseObject::FlagType_Set);

                        nCanChoiceCount = m_arrayPlayer[player].flagShouPai(_BaseObject::Flag_Enable,_Pai::Value_All);
                        FlagMenus(_BaseObject::Flag_Null,_BaseObject::Flag_Enable,_BaseObject::Flag_Null);

                        m_arrayStep[nStep].bSelfFlag = true;
                        m_arrayStep[nStep].bMultipleFlag = true;
                        m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 2;
                        m_arrayStep[nStep].nType = _BaseObject::Area_ShouPai;

                        if(m_arrayPlayer[player].isMe())
                        {
                            m_strMsg = _T("技能 %1 发动，请弃两张手牌或掉1血")
                                    .arg(_JiNeng::getName(_JiNeng::JiNengValue_DaHangHaiShiDai));
                            ShowChuPaiMessage(m_strMsg, 0);
                        }
                        break;
                    case 1:
                        //nCanChoiceCount = 2;
                        FlagMenus(_BaseObject::Flag_Enable,_BaseObject::Flag_Enable,_BaseObject::Flag_Null);

                        m_arrayStep[nStep].bSelfFlag = true;
                        m_arrayStep[nStep].bMultipleFlag = false;
                        m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                        m_arrayStep[nStep].nType = _BaseObject::Area_Button;

                        //shortMsg = _T("使用%1")
                        //        .arg(_Pai::getName(_Pai::Value_Sha));
                        break;

                    default:
                        emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR: DaHangHaiShiDai Step!"));
                        setGameStatus(Game_Status_ERROR);
                        return -1;
                    }
                    break;

                default:
                    emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR: DaHangHaiShiDai nParam!"));
                    setGameStatus(Game_Status_ERROR);
                    return -1;
                }
                break;
            }
        }
        break;


    case GameCore::Game_ChuPai_Type_QiPai:    //弃牌
        {
            switch(nStep)   //nParam1/2为数量
            {
            case 0:
                ResetAllPlayers(-1);
                //FlagAllPlayers(_BaseObject::Flag_Null,_BaseObject::FlagType_Set);

                m_arrayPlayer[player].flagZhuangBeiByValue(_BaseObject::Flag_Null,_Pai::Value_All);
                nCanChoiceCount = m_arrayPlayer[player].flagShouPai(_BaseObject::Flag_Enable,_Pai::Value_All);
                FlagMenus(_BaseObject::Flag_Null,_BaseObject::Flag_Enable,_BaseObject::Flag_Null);


                m_arrayStep[nStep].bSelfFlag = true;
                m_arrayStep[nStep].bMultipleFlag = true;
                m_arrayStep[nStep].nMinCount = nParam1;
                m_arrayStep[nStep].nMaxCount = nParam2;
                m_arrayStep[nStep].nType = _BaseObject::Area_ShouPai;

                if(m_arrayPlayer[player].isMe())
                {
                    m_strMsg = m_hashGameMessage[_Pai::Value_All][1]
                            .arg(nParam1);
                    ShowChuPaiMessage(m_strMsg, 0);
                }

                break;

            case 1:
                //nCanChoiceCount = 2;
                FlagMenus(_BaseObject::Flag_Enable,_BaseObject::Flag_Enable,_BaseObject::Flag_Null);

                m_arrayStep[nStep].bSelfFlag = true;
                m_arrayStep[nStep].bMultipleFlag = false;
                m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 1;
                m_arrayStep[nStep].nType = _BaseObject::Area_Button;

                //shortMsg = _T("弃牌确定?");
                break;

            default:
                emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR QiPai!"));
                setGameStatus(Game_Status_ERROR);
                return -1;
            }
        }
        break;

    default:
        emit s_Critical(_T("[!GameCore]InitChuPaiStatus ERROR!"));
        setGameStatus(Game_Status_ERROR);
        return -1;
    }


    return nCanChoiceCount;
}

/*
int GameCore::ResetAllFlags()        //将已点选的重新设置
{
    int i = 0;
    for(; i < playerNum; i++)
    {
        int j = 0;
        for(; j < m_arrayPlayer[i].ShouPaiCount; j++)
        {
            m_arrayPlayer[i].ShouPai[j].iFlag = _BaseObject::Flag_Null;
        }
        m_arrayPlayer[i].TouXiang.iFlag = _BaseObject::Flag_Null;

    }
    for(;i < 3; i++)
    {
        Button[i].iFlag = _BaseObject::Flag_Null;
    }
    return 0;
}
*/


GameCore::_GameButtonValue GameCore::ChuPai(int player, _GameChuPaiType eType, int nValue, int nParam1, int nParam2, QVariant nParam3, int nInitStep, QString strMsg)
{
    int     nStep = nInitStep;  //目前是第几步骤
    int     iIndex = -1;        //回退模式(保存到要回退的第几步骤),-1表示不回退
    bool    bInitFlag = false;  //是否已经初始化过(false表示需要刷新)
    int     nCanChoiceCount = 0;
    _GameButtonValue ret = Game_Button_ERROR;           //返回值

    memset(m_arrayStep + nInitStep,0,sizeof(PokeStep) * (GAME_MAX_NUM_STEP - nInitStep));
    m_nStepCount = -1;

    //startChuPai(player);

    if(m_arrayPlayer[player].isComputer())
    {
        //Sleep(m_ComputerDelay);
    }
    while(1)        //一次出牌循环
    {
        if(!bInitFlag)
        {
            nCanChoiceCount = InitChuPaiStatus(player,eType,nValue,nParam1,nParam2,nParam3,nStep,strMsg);        //规划步骤,设置显示是否可点击
            bInitFlag = true;
        }
        if(iIndex >= nStep)                //回退,重新从第0步骤开始刷新牌
        {
            if(ResetAllFlagsByStep(nStep) < 0)
            {
                emit s_Critical("[!GameCore]ChuPai Error!");
                setGameStatus(Game_Status_ERROR);
                return Game_Button_ERROR;
            }

            //还不是本次选择步骤,则继续刷新
            if(iIndex > nStep)
            {
                nStep ++;
                bInitFlag = false;
                continue;
            }
        }

        iIndex = -1;

        for(;;)     //点击一张牌
        {
            if(m_arrayPlayer[player].isMe() && !m_arrayPlayer[player].m_bTuoGuan)
            {
                //ComputerChuPai(-1,0,0,Game_ChuPai_Type_ZhuDong,-1);
                //RefreshUI();
                emit s_RefreshAllFlags();
                emit s_RefreshAllPokePosition();
                //qDebug() << "选牌:";
                WaitForUserAction();
                //qDebug() << "选牌Over:";
                if(gameStatus() != Game_Status_Continue)
                    return Game_Button_ERROR;
            }
            else if(m_arrayPlayer[player].isComputer() || m_arrayPlayer[player].m_bTuoGuan)
            {
                //stopChuPai(player);
                if(eType == GameCore::Game_ChuPai_Type_QiPai)  //电脑弃牌
                {
                    _ClickButton_(Game_Button_Cancel);
                    break;
                }
                else    //电脑出牌
                {
                    ComputerChuPai(player, nStep, nCanChoiceCount, eType, nValue, nParam1,nParam2,nParam3);
                    if(gameStatus() != Game_Status_Continue)
                        return Game_Button_ERROR;
                }
            }

            if(m_DianJiPai.nFlags & _BaseObject::Flag_Enable)
                break;
        }

        //选择按钮,则退出选牌
        if(m_DianJiPai.nType == _BaseObject::Area_Button)
        {
            //stopChuPai(player);
            if(m_DianJiPai.nValue == Game_Button_Cancel)
            {
                //随机弃牌
                if(eType == GameCore::Game_ChuPai_Type_QiPai)
                {
                    if(ComputerQiPai(player,nParam1,nParam2) < 0)
                        return Game_Button_ERROR;

                    ret = Game_Button_OK;
                    m_nStepCount = 2;
                }
                //重新选择
                else if(eType == GameCore::Game_ChuPai_Type_ZhuDong)
                {
                    memset(m_arrayStep,0,sizeof(m_arrayStep));
                    m_nStepCount = -1;
                    nStep = nInitStep;
                    iIndex = -1;
                    bInitFlag = false;
                    continue;
                }
                else if(eType == GameCore::Game_ChuPai_Type_Pai)
                {
                    ret = Game_Button_Cancel;
                    m_nStepCount = 1;
                }
                else if(eType == GameCore::Game_ChuPai_Type_JiNeng)
                {
                    ret = Game_Button_Cancel;
                    m_nStepCount = 1;
                }
                else
                {
                    emit s_Critical(_T("[!GameCore]ChuPai ERROR 2!"));
                    setGameStatus(Game_Status_ERROR);
                    return Game_Button_ERROR;
                }
            }
            else if(m_DianJiPai.nValue == Game_Button_OK)
            {
                m_nStepCount = nStep + 1;
                ret = (_GameButtonValue)m_DianJiPai.nValue;
            }
            else if(m_DianJiPai.nValue == Game_Button_Giveup)
            {
                m_nStepCount = 1;
                ret = (_GameButtonValue)m_DianJiPai.nValue;
            }
            else
            {
                emit s_Critical(_T("[!GameCore]ChuPai ERROR 3!"));
                setGameStatus(Game_Status_ERROR);
                return Game_Button_ERROR;
            }

            iIndex = -1;


            //全部置NULL
            //FlagAllPlayers(_BaseObject::Flag_Null,_BaseObject::FlagType_Set);
            /*if(iMyID >= 0)
            {
                m_arrayPlayer[iMyID].flagZhuangBeiByValue(_BaseObject::Flag_Null,_Pai::Value_All);
                m_arrayPlayer[iMyID].flagShouPai(_BaseObject::Flag_Null,_Pai::Value_All);
            }*/

            FlagMenus(_BaseObject::Flag_Null,_BaseObject::Flag_Null,_BaseObject::Flag_Null);

            HidePlayersArea();

            ResetAllPlayers();
            emit s_RefreshAllFlags();
            //emit s_RefreshAllPokePosition();

            break;//end while(1)
        }
        /*/技能
        else if(m_DianJiPai.nType == _BaseObject::Area_JiNeng)
        {
            m_arrayStep[0].nSelectValue[0] = m_DianJiPai.nValue;
            m_arrayStep[0].nSelectType[0] = m_DianJiPai.nType;
            m_arrayStep[0].nSelectPlayerID = m_DianJiPai.nPlayerID;        //牌 所属玩家ID
            m_arrayStep[0].nSelectCount = 1;
            return Game_Button_JiNeng;
        }*/


        //倒序遍历每个步骤
        int i = nStep;
        for(; i >= 0; i--)
        {
            //能选的地方是否一致
            bool bChoiceType = m_DianJiPai.nType & m_arrayStep[i].nType;

            //如果选择的类型是 武将,则不判断bSelfFlag
            if(bChoiceType && (m_DianJiPai.nType != _BaseObject::Area_Player))
            {
                bChoiceType = ((m_arrayStep[i].bSelfFlag && m_DianJiPai.nPlayerID == player) //如果规定选自己的牌,则判断 nPlayerID是否是自己
                                        || (!m_arrayStep[i].bSelfFlag && m_DianJiPai.nPlayerID != player));  //反之
            }

            //是要选的类型
            if(bChoiceType)
            {
                if(m_DianJiPai.nFlags & _BaseObject::Flag_Clicked)    //已点,则:找到,取消,个数-1,改变状态
                {
                    for(int j = 0; j < m_arrayStep[i].nSelectCount; j++)    //遍历值
                    {
                        if(m_DianJiPai.nValue == m_arrayStep[i].nSelectValue[j])    //找到值
                        {
                            //删掉值
                            for(int k = j; k < m_arrayStep[i].nSelectCount - 1; k++)
                            {
                                m_arrayStep[i].nSelectValue[k] = m_arrayStep[i].nSelectValue[k+1];
                                m_arrayStep[i].nSelectType[k] = m_arrayStep[i].nSelectType[k+1];
                            }
                            m_arrayStep[i].nSelectCount--;
                            m_DianJiPai.pObject->clearSomeFlags(_BaseObject::Flag_Clicked);

                            //如果是单选 或 不是本步骤要选的
                            if(!m_arrayStep[i].bMultipleFlag || i != nStep)
                            {
                                //如果是多选,且点选的牌数符合规定,则回退到i + 1
                                if(m_arrayStep[i].bMultipleFlag && m_arrayStep[i].nSelectCount >= m_arrayStep[i].nMinCount && m_arrayStep[i].nSelectCount <= m_arrayStep[i].nMaxCount)
                                {
                                    iIndex = i + 1;
                                    nStep = nInitStep;
                                    bInitFlag = false;
                                }
                                else    //否则
                                {
                                    iIndex = i;
                                    nStep = nInitStep;
                                    bInitFlag = false;
                                }
                            }

                            //如果是多选且本轮要选的
                            else
                            {
                                //选够,下一步骤
                                if(m_arrayStep[i].nSelectCount >= m_arrayStep[i].nMinCount && m_arrayStep[i].nSelectCount <= m_arrayStep[i].nMaxCount)
                                {
                                    iIndex = 0;
                                    nStep ++;
                                    bInitFlag = false;
                                }
                                //没有选够,继续选
                                else
                                {
                                    iIndex = 0;
                                    bInitFlag = true;
                                }
                            }
                            i = -2; //处理完毕,退出(i作为标记了)
                            break;
                        }
                    }   //end for
                    if(i == -2)break;
                    else continue;      //不是本回合
                }
                else    //未点,则:
                {
                    m_DianJiPai.pObject->setSomeFlags(_BaseObject::Flag_Clicked);
                    //单张,切换并刷新
                    if(!m_arrayStep[i].bMultipleFlag)
                    {
                        if(m_arrayStep[i].nSelectCount != 0)   //本步已经选过其他牌,则回退
                        {
                            iIndex = i + 1;
                            nStep = nInitStep;
                            bInitFlag = false;
                        }
                        else
                        {
                            iIndex = 0;
                            nStep ++;
                            bInitFlag = false;
                        }
                        m_arrayStep[i].nSelectCount = 0;
                    }
                    //多张
                    else
                    {
                        //选够,下一步
                        if(m_arrayStep[i].nSelectCount + 1 >= m_arrayStep[i].nMinCount && m_arrayStep[i].nSelectCount + 1 <= m_arrayStep[i].nMaxCount)
                        {
                            //此次出牌阶段,不刷新
                            if(i == nStep)
                            {
                                iIndex = 0;
                                nStep ++;
                                bInitFlag = false;
                            }
                            //非此次阶段,重新刷新
                            else
                            {
                                iIndex = i + 1;
                                nStep = nInitStep;
                                bInitFlag = false;
                            }
                        }
                        else //没够或多于
                        {
                            //此次出牌阶段,不刷新
                            if(i == nStep)
                            {
                                iIndex = 0;
                                //iIndex = nStep - 1;
                                bInitFlag = true;
                            }
                            //非此次阶段,重新刷新
                            else
                            {
                                iIndex = i;
                                nStep = nInitStep;
                                bInitFlag = false;
                            }
                        }
                    }

                    //保存
                    if(!(m_DianJiPai.nFlags & _BaseObject::Flag_Enable))    //牌 状态
                    {
                        emit s_Critical(_T("[!GameCore]ChuPai ERROR Flags!"));
                        setGameStatus(Game_Status_ERROR);
                        return Game_Button_ERROR;
                    }
                    m_arrayStep[i].nSelectValue[m_arrayStep[i].nSelectCount] = m_DianJiPai.nValue;
                    m_arrayStep[i].nSelectType[m_arrayStep[i].nSelectCount] = m_DianJiPai.nType;
                    m_arrayStep[i].nSelectPlayerID = m_DianJiPai.nPlayerID;        //牌 所属玩家ID
                    m_arrayStep[i].nSelectCount++;
//                    if(m_DianJiPai.nType == _BaseObject::Area_Button)    //按钮,直接返回
//                    {
//                        FlagAllPlayers(_BaseObject::Flag_Null,0);
//                        m_arrayPlayer[iMyID].flagZhuangBeiByValue(_BaseObject::Flag_Null,_Pai::Value_All);
//                        m_arrayPlayer[iMyID].flagShouPai(_BaseObject::Flag_Null,_Pai::Value_All);

//                        //stopChuPai(player);
//                        ret = m_DianJiPai.nValue;
//                        break;
//                    }
                    break;
                }
            }
            else        //类型不同,则将此步骤取消
            {
                m_arrayStep[i].nSelectCount = 0;
            }
        }       //end for
        if(i == -1)
        {
            emit s_Critical(_T("[!GameCore]ChuPai ERROR: can't find type!"));  //没找到类型
            setGameStatus(Game_Status_ERROR);
            return Game_Button_ERROR;
        }
        if(ret != Game_Button_ERROR)       //按钮,这步好像运行不到
            break;

        if(iIndex >= 0)continue;    //开始下一轮或刷新
        else if(iIndex == -1)break; //这步好像运行不到
    }

    //stopChuPai(player);
    return (_GameButtonValue)ret;

}


int GameCore::ResetAllFlagsByStep(int nStep)
{
    if(nStep >= GAME_MAX_NUM_STEP || nStep < 0)
    {
        emit s_Critical("[!GameCore]ResetAllFlagsByStep Error!");
        return -1;
    }

    for(int i = 0; i < m_arrayStep[nStep].nSelectCount; i++)
    {
        switch(m_arrayStep[nStep].nSelectType[i])
        {
        case _BaseObject::Area_Player:
            m_arrayPlayer[m_arrayStep[nStep].nSelectValue[i]].setSomeFlags(_BaseObject::Flag_Clicked);
            break;
        case _BaseObject::Area_ZhuangBei:
            m_arrayPlayer[m_arrayStep[nStep].nSelectPlayerID].getZhuangBeiData((_BaseObject::_Area)m_arrayStep[nStep].nSelectValue[i])->setSomeFlags(_BaseObject::Flag_Clicked);
            break;
        case _BaseObject::Area_PanDing:
            m_arrayPlayer[m_arrayStep[nStep].nSelectPlayerID].getPandingData(m_arrayStep[nStep].nSelectValue[i])->setSomeFlags(_BaseObject::Flag_Clicked);
            break;
        case _BaseObject::Area_ShouPai:
            m_arrayPlayer[m_arrayStep[nStep].nSelectPlayerID].getShouPaiData(m_arrayStep[nStep].nSelectValue[i])->setSomeFlags(_BaseObject::Flag_Clicked);
            break;
        case _BaseObject::Area_JiNeng:
            m_arrayPlayer[m_arrayStep[nStep].nSelectPlayerID].getJiNengPaiData(m_arrayStep[nStep].nSelectValue[i])->setSomeFlags(_BaseObject::Flag_Clicked);
            break;
        default:
            emit s_Critical("[!GameCore]ResetAllFlagsByStep Error!");
            return -2;
        }
    }

    /*
    int i = 0;
    for(; i <= nStep; i++)
    {
        for(int j = 0; j < step[i].nSelectCount; j++)
        {
            switch(step[i].nType)
            {
            case POKE_TYPE_SHOUPAI:
                m_arrayPlayer[0].ShouPai[j].nFlag ^= _BaseObject::Flag_Clicked;
            case POKE_TYPE_PLAYER:
                m_arrayPlayer[0].
            }
        }
    }
    */
    return 0;
}

int GameCore::ChuPai_ZhangBa(int player, _GameChuPaiType eType, int nStep)
{
    int nCanChoiceCount =
            m_arrayPlayer[player].flagShouPai(_BaseObject::Flag_Enable,_Pai::Value_All);

    if(eType == Game_ChuPai_Type_ZhuDong)
        FlagMenus(_BaseObject::Flag_Null,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);
    else
        FlagMenus(_BaseObject::Flag_Null,_BaseObject::Flag_Enable,_BaseObject::Flag_Null);

    m_arrayStep[nStep].bSelfFlag = true;
    m_arrayStep[nStep].bMultipleFlag = true;
    m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 2;
    m_arrayStep[nStep].nType = _BaseObject::Area_ShouPai;

    if(m_arrayPlayer[player].isMe())
    {
        m_strMsg = m_hashGameMessage[_Pai::Value_ZhangBa][0]
                .arg(_Pai::getName(_Pai::Value_Sha));
                //.arg(_Pai::getName(_Pai::Value_ZhangBa));
        ShowChuPaiMessage(m_strMsg, 0);
    }
    return nCanChoiceCount;
}

int GameCore::ChuPai_TanSu(int player, _GameChuPaiType eType, int nStep)
{
    m_arrayPlayer[player].flagShouPai(_BaseObject::Flag_Null,_Pai::Value_All);
    int nCanChoiceCount =
            m_arrayPlayer[player].flagShouPai(_BaseObject::Flag_Enable,_Pai::Value_Sha);

    if(eType == Game_ChuPai_Type_ZhuDong)
        FlagMenus(_BaseObject::Flag_Null,_BaseObject::Flag_Enable,_BaseObject::Flag_Enable);
    else
        FlagMenus(_BaseObject::Flag_Null,_BaseObject::Flag_Enable,_BaseObject::Flag_Null);

    m_arrayStep[nStep].bSelfFlag = true;
    m_arrayStep[nStep].bMultipleFlag = true;
    m_arrayStep[nStep].nMaxCount = m_arrayStep[nStep].nMinCount = 2;
    m_arrayStep[nStep].nType = _BaseObject::Area_ShouPai;

    if(m_arrayPlayer[player].isMe())
    {
        m_strMsg = m_hashGameMessage[_Pai::Value_TanSu][0]
                .arg(_Pai::getName(_Pai::Value_Sha));
                //.arg(_Pai::getName(_Pai::Value_TanSu));
        ShowChuPaiMessage(m_strMsg, 0);
    }
    return nCanChoiceCount;
}
